<template>
  <div class="content-container" style="height: calc(100vh - 60px)">
    <div class="tabs">
      <div class="tab" >{{policyType.name}}</div>
    </div>
    <div class="tab-content">
      <div class="panel" >
        <div class="list-item" @click="$router.push({path:'/policy-detail',query:{zcxh00:item.zcxh00}})" :key="index" v-for="(item,index) in policyData">
          <div class="title">{{item.zcbt00}}</div>
          <div class="time">{{item.zcsjsj.substring(0,10)}}</div>
        </div>
        <empty-data-panel v-if="policyData.length==0"></empty-data-panel>
      </div>
    </div>
  </div>
</template>
<script>
import ReturnBtn from "@/views/components/ReturnBtn.vue";
import {policyApi} from "@/api";

export default {
  name:"policy-list",
  components:{
    ReturnBtn
  },
  data(){
    return {
      policyType:{},
      queryPolicyParam:{
        page:1,
        limit:10
      },
      queryNewsParam:{
        page:1,
        limit:10
      },
      policyData:[
      ]
    }
  },
  mounted() {
    this.policyType=this.$route.query
    console.log(this.policyType)
    this.queryPolicy()
  },
  methods: {
    queryPolicy(){
      policyApi.queryPolicy({zclx00:this.policyType.value,page:this.queryPolicyParam.page,limit: this.queryPolicyParam.limit}).then((res) => {
        this.policyData = res.data.records
      }).catch(()=>{

      })
    }

  }
}
</script>
<style lang="scss" scoped>
.tabs{

   color: white;
   display: flex;
   height: 80px;
  .tab{
    border-radius: 10px;
    background-color: #52489C;
    cursor: pointer;
    margin-top: 5px;
    width: 85%;
    height: 100%;
    line-height: 80px;
    font-size: xxx-large;
    margin-left: auto;
    margin-right: auto;
  }



}
.tab-content{
  margin-top: 20px;
  padding-bottom: 20px;
  .panel{
    border-radius: 10px;
    background-color: #52489C;
    width: 85%;
    margin-left: auto;
    margin-right: auto;
    height: 700px;
    .list-item{
      cursor: pointer;
      display: flex;
      font-size: 30px;
      color: white;
      .title{
        padding: 30px 0px 0px 40px;
        flex: 1;
        text-align: left;
      }
      .time{
        width: 200px;
        padding: 30px 20px 0px 0px;
        text-align: right;
      }
    }


  }

}
</style>
